package utils;

import java.awt.Dimension;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.Window;

public final class ScreenUtils {

    public final static void setMiddleScreen(Window window){

		Point pointCenter = getCenterScreen();

		int x = (int) (pointCenter.getX() / 2 - window.getWidth() / 2);
		int y = (int) (pointCenter.getY()/ 2 - window.getHeight() / 2);

		window.setLocation(x, y);
	}

    private static Point getCenterScreen() {
        Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();

        return new Point((int) dimension.getWidth(), (int) dimension.getHeight());
    }
    
}

